/*
 * Copyright 2013 Nicholas Bilyk
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package jasper.model.elements;

import javax.xml.stream.events.Namespace;

/**
 *
 * An enumeration of primitive xml data types.
 *
 * http://msdn.microsoft.com/en-us/library/ms256220.aspx
 *
 * @author nbilyk
 */
public enum AttributeType implements IAttributeType {

	/**
	 * Represents a URI as defined by RFC 2396. An anyURI value can be absolute or relative, and may have an optional
	 * fragment identifier.
	 */
	ANY_URI("anyURI"),

	/**
	 * Represents Base64-encoded arbitrary binary data. A base64Binary is the set of finite-length sequences of binary
	 * octets.
	 */
	BASE_64_BINARY("base64Binary"),

	/**
	 * Represents Boolean values, which are either true or false.
	 */
	BOOLEAN("boolean"),

	/**
	 * Represents a calendar date.
	 * The pattern for date is CCYY-MM-DD with optional time zone indicator as allowed for dateTime.
	 */
	DATE("date"),

	/**
	 * Represents a specific instance of time.
	 * The pattern for dateTime is CCYY-MM-DDThh:mm:ss where CC represents the century, YY the year, MM the month,
	 * and DD the day, preceded by an optional leading negative (-) character to indicate a negative number. If the
	 * negative character is omitted, positive (+) is assumed. The T is the date/time separator and hh, mm, and ss
	 * represent hour, minute, and second respectively. Additional digits can be used to increase the precision of
	 * fractional seconds if desired. For example, the format ss.ss... with any number of digits after the decimal
	 * point is supported. The fractional seconds part is optional.
	 * This representation may be immediately followed by a "Z" to indicate Coordinated Universal Time (UTC) or to
	 * indicate the time zone. For example, the difference between the local time and Coordinated Universal Time,
	 * immediately followed by a sign, + or -, followed by the difference from UTC represented as hh:mm (minutes is
	 * required). If the time zone is included, both hours and minutes must be present.
	 */
	DATE_TIME("dateTime"),

	/**
	 * Represents arbitrary precision numbers.
	 */
	DECIMAL("decimal"),

	/**
	 * Represents double-precision 64-bit floating-point numbers.
	 */
	DOUBLE("double"),

	/**
	 * Represents a duration of time.
	 * The pattern for duration is PnYnMnDTnHnMnS, where nY represents the number of years, nM the number of months,
	 * nD the number of days, T the date/time separator, nH the number of hours, nM the number of minutes, and nS the
	 * number of seconds.
	 */
	DURATION("duration"),

	/**
	 * Represents single-precision 32-bit floating-point numbers.
	 */
	FLOAT("float"),

	/**
	 * Represents a Gregorian day that recurs, specifically a day of the month such as the fifth day of the month.
	 * A gDay is the space of a set of calendar dates. Specifically, it is a set of one-day long, monthly periodic
	 * instances.
	 * The pattern for gDay is ---DD with optional time zone indicator as allowed for date.
	 */
	G_DAY("gDay"),

	/**
	 * Represents a Gregorian month that recurs every year. A gMonth is the space of a set of calendar months.
	 * Specifically, it is a set of one-month long, yearly periodic instances.
	 * The pattern for gMonth is --MM-- with optional time zone indicator as allowed for date.
	 */
	G_MONTH("gMonth"),

	/**
	 * Represents a specific Gregorian date that recurs, specifically a day of the year such as the third of May.
	 * A gMonthDay is the set of calendar dates. Specifically, it is a set of one-day long, annually periodic
	 * instances.
	 * The pattern for gMonthDay is --MM-DD with optional time zone indicator as allowed for date.
	 */
	G_MONTH_DAY("gMonthDay"),

	/**
	 * Represents a Gregorian year. A set of one-year long, nonperiodic instances.
	 * The pattern for gYear is CCYY with optional time zone indicator as allowed for dateTime.
	 */
	G_YEAR("gYear"),

	/**
	 * Represents a specific Gregorian month in a specific Gregorian year. A set of one-month long, nonperiodic instances.
	 * The pattern for gYearMonth is CCYY-MM with optional time zone indicator.
	 */
	G_YEAR_MONTH("gYearMonth"),

	/**
	 * Represents arbitrary hex-encoded binary data. A hexBinary is the set of finite-length sequences of binary
	 * octets. Each binary octet is encoded as a character tuple, consisting of two hexadecimal digits ([0-9a-fA-F])
	 * representing the octet code.
	 */
	HEX_BINARY("hexBinary"),

	/**
	 * Represents a NOTATION attribute type. A set of QNames.
	 */
	NOTATION("NOTATION"),

	/**
	 * Represents character strings.
	 */
	STRING("string"),

	/**
	 * Represents an instance of time that recurs every day.
	 * The pattern for time is hh:mm:ss.sss with optional time zone indicator.
	 */
	TIME("time"),

	/**
	 * Represents a qualified name. A qualified name is composed of a prefix and a local name separated by a colon.
	 * Both the prefix and local names must be an NCName. The prefix must be associated with a namespace URI reference,
	 * using a namespace declaration.
	 */
	Q_NAME("QName");

	private String type;

	private Namespace namespace;

	private AttributeType(String type) {
		this.type = type;

		// TODO: Figure out namespace
//		this.namespace = Element.DEFAULT_NAMESPACE;
	}

	@Override
	public String getType() {
		return type;
	}

	@Override
	public Namespace getNamespace() {
		return namespace;
	}


}
